package com.iot.ic.service;

import com.iot.ic.common.Constant;
import com.iot.ic.dao.LocationMapper;
import com.iot.ic.dao.LogMapper;
import com.iot.ic.model.Device;
import com.iot.ic.model.Location;
import com.iot.ic.model.Log;
import com.iot.ic.tcp.model.Point;
import com.iot.ic.utils.OkHttpUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by xiuge on 2017/7/10.
 */
@Service
public class LogServiceImpl implements LogService {

    @Autowired
    private LogMapper logMapper;

	@Override
	public int addLogs(String userCode, String userName, Date logTime, String message, String detailMessage) {
		Log log = new Log();
		log.setUserCode(userCode);
		log.setUserName(userName);
		log.setLogTime(new Date());
		log.setMessage(message);
		log.setDetailMessage(detailMessage);
		int result = logMapper.insert(log);
		return result;
	}

	@Override
	public List<Log> selectAll(int start, int size) {
		return logMapper.selectAll(start, size);
	}

	@Override
	public int selectAllNumber() {
		return logMapper.selectAllNumber();
	}


}
